package com.yida.gwj.expend.outside.controller;

import com.yida.common.core.web.domain.AjaxResult;
import com.yida.common.security.annotation.InnerAuth;
import com.yida.common.security.annotation.RequiresPermissions;
import com.yida.gwj.expend.outside.domain.GwjMaintenanceFundsBusinessAttachment;
import com.yida.gwj.expend.outside.domain.dto.AllocatedAmountSelectDTO;
import com.yida.gwj.expend.outside.domain.dto.ChangeSchemeDTO;
import com.yida.gwj.expend.outside.domain.request.AllocatedAmountRequest;
import com.yida.gwj.expend.outside.service.GwjConfNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static com.yida.common.core.utils.PageUtils.startPage;

/**
 * @Description 公维金信息公示Controller
 * @Author wws
 * @Date 2023-06-21
 */
@RestController
@RequestMapping("/config/notice")
@Api(tags = "公维金信息公示")
public class GwjConfNoticeController {


    @Resource
    private GwjConfNoticeService gwjConfNoticeService;

    /**
     * 附件列表查询
     *
     * @return
     */
    @ApiOperation(value = "附件列表查询", response = GwjMaintenanceFundsBusinessAttachment.class)
    @GetMapping("/attachmentList")
    public AjaxResult selectMaintenanceFundsBusinessAttachment(GwjMaintenanceFundsBusinessAttachment gwjMaintenanceFundsBusinessAttachment) {
        return AjaxResult.success(gwjConfNoticeService.selectMaintenanceFundsBusinessAttachment(gwjMaintenanceFundsBusinessAttachment));
    }

    /**
     * 查询维修和更新、改造方案
     * @return
     */
    @ApiOperation(value = "查询维修和更新、改造方案", response = ChangeSchemeDTO.class)
    @GetMapping("/getTransformationPlan/{bizId}")
    public AjaxResult getTransformationPlan(@PathVariable("bizId") Long bizId) {
        return AjaxResult.success(gwjConfNoticeService.getTransformationPlan(bizId));
    }


    /**
     * 分摊金额列表
     */
    @ApiOperation(value = "分摊范围及金额-选中房屋列表", response = AllocatedAmountSelectDTO.class)
    @PostMapping("/allocated/amount/list")
    public AjaxResult allocatedAmountList(@Validated @RequestBody AllocatedAmountRequest allocatedAmountRequest) {
        startPage();
        return AjaxResult.success(gwjConfNoticeService.allocatedAmountList(allocatedAmountRequest));
    }

}
